package com.example.mapp;

import com.example.entity.detection.DetectionElevator;
import com.example.entity.detection.ExtDetectionElevator;
import com.example.mapp.buildSql.DetectionElevatorMappSql;
import org.apache.ibatis.annotations.*;

import java.util.List;
import java.util.Map;

@Mapper
public interface DetectionElevatorMapp {
    @SelectProvider(type = DetectionElevatorMappSql.class,method = "queryDetectionElevator")
    List<ExtDetectionElevator> query(ExtDetectionElevator detectionElevator) throws Exception;

    @UpdateProvider(type = DetectionElevatorMappSql.class,method = "updateDetectionElevator")
    int update(Map map) throws Exception;

    @Insert("INSERT INTO detection_elevator (be_check_party_user_sign, be_check_party_user_time, check_time, " +
            "detecte_user_sign_first, detecte_user_sign_second, detecte_user_sign_time_first, detecte_user_sign_time_second," +
            " elevator_num, is_pass, original_record_url, pic1, pic2, pic3, plan_detail_id, report_url) VALUES  " +
            "(#{beCheckPartyUserSign}, #{beCheckPartyUserTime}, #{checkTime}, #{detecteUserSignFirst}, #{detecteUserSignSecond}, " +
            "#{detecteUserSignTimeFirst}, #{detecteUserSignTimeSecond}, #{elevatorNum}, #{isPass}," +
            " #{originalRecordUrl}, #{pic1}, #{pic2}, #{pic3},#{planDetailId},#{reportUrl})")
    @SelectKey(statement = "select last_insert_id()", keyProperty = "id", keyColumn = "id",before = false,resultType = Long.class)
    int insert(DetectionElevator detectionElevator) throws Exception;

    @Delete("delete from demand_maintance_apply where id=#{id}")
    int delete(String id) throws  Exception;

    @SelectProvider(type = DetectionElevatorMappSql.class,method = "countElevator")
    Map<String,Object> countElevator(Map map) throws Exception;
}
